<template>
  <view>
    <view>姓名:{{ username }}</view>
    <view>地址:{{ address }}</view>
    <button type="primary" size="mini" @click="handleClick">改变姓名</button>
    <button type="primary" size="mini" @click="handleAddress">改变地址</button>

  </view>
</template>

<script>
import { ref } from "vue"
export default {
  data() {
    return {
      address: "北京"
    }
  },
  setup() {
    let username = ref("张三")
    const handleClick = function () {
      username.value = "李四"
    }
    const handleAddress = -function () {
      address.value = "上海"
    }
    return {
      username,
      handleClick
    }
  },
  // methods: {
  //   handleClick() {
  //     console.log("我被点击了")
  //   }
  // }
}

</script>

<style></style>